<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
    <script type="text/javascript">
      var twoSum = function(nums, target) {
          var map = new Map();
          for(let i = 0;i < nums.length; i++){
              substra = target - nums[i];
              if(map.has(substra)){
                  return [i,map.get(substra)]
              }
              map.set(nums[i],i)
          }
          return false;
      }
      
      // 测试
      const nums = [2,7,11,15];
      console.log(twoSum(nums,26));
    </script>
	</body>
</html>
